package com.icloud.cer.rest.msg.processor;

import org.apache.mina.core.session.IoSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.icloud.cer.rest.msg.MessageHolder;
import com.icloud.cer.rest.msg.bean.HeartbeatResponse;

public class Msg152Processor extends BaseMessageProcessor {

	private final Logger log = LoggerFactory.getLogger(Msg102Processor.class);
	
	@Override
	public void process(IoSession session, MessageHolder holder) {
		long sessionId = session.getId();
		HeartbeatResponse heartResponse  = (HeartbeatResponse)holder.getValue(); 
		int status = heartResponse.getStatus();
		updateEncryptorStatus(sessionId, status);
	}
	
	private void updateEncryptorStatus(long sessionId, int status) {
		log.info("sessionId:" + sessionId + " 更新加密机状态:" + status);
		connectorManager.updateClient(sessionId, status);
	}
}
